import Vue from 'vue'
import VueRouter from 'vue-router'

// 引入组件-懒加载
let Login = ()=>import('../views/Login.vue')
let Layout = ()=>import('../views/Layout.vue')
let Role = ()=>import('../views/role/Index.vue')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: 'role',
        component: Role
      }
    ]
  },
  {
    path: '/login',
    component: Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
